
@echo off

if     "%1" == "clean" goto clean
if     "%1" == "slk" goto slk 
if     "%1" == "lr" goto lr
if     "%1" == "comp" goto comp
if     "%1" == "help" goto usage
if     "%1" == "" goto usage

:slk
%SLK%slk %2 %3 %4 %5 -cs dsl.ll > slk.out
sed -e "/#include SlkExecute.txt/ r SlkExecute.txt" action.txt > SlkAction.cs
goto comp

:lr
%SLK%slk %2 %3 %4 %5 -cs -LR dsl.lr > slk.out
goto exit

:comp
cscc *.cs -o calc.exe
goto exit

:clean
	@rm -f *.obj
        @rm -f *.out
	@rm -f *.lst
        @rm -f *.err
	@rm -f *.map
        @rm -f *.def
	@rm -f *.exe
        @rm -f *.class
        @rm -f SlkKeywords.txt
        @rm -f SlkExecute.txt
        @rm -f SlkAction.cs
        @rm -f SlkString.cs
        @rm -f SlkConstants.cs
        @rm -f SlkParser.cs
        @rm -f SlkState.*        
	@rm -f xxx*

goto exit

:usage
echo Usage:  mak [clean] [help] [comp] [slk] [flags] 
echo         ilrun calc     to run the program

:exit
